#ifndef __MATRIX__
#define __MATRIX__

#include "Triple.h"

class Quaternion;

// 3-by-3 matrix
class Matrix
{
private:
	Triple coord[3];
	void Transpose(int i, int j);
public:
	// use this if member is read-only
	//Triple const & operator[](const int index) const
	Triple & operator[](const int index) 
	{
	    return coord[index];
	}
	Matrix();
	void print_ht(ostream& os, char *title);
	void operator=(Matrix& src);
	void LoadIdentity();
	void Transpose();
	void Transpose(Matrix& src); // cannot be applied on the same object
	void operator=(Triple &t); // STAR procedure
	void operator*(const float s);
	friend const Triple operator*(Matrix& left, Triple& right);
	//friend const Triple operator*(const Triple& left, Matrix& right);
	friend Matrix operator*(Matrix& left, Matrix& right);
	//void Multiply__t(Matrix *a, Matrix *b); // b is transposed
	void operator=(Quaternion& q);
};

//void store_matrix(ostream& os, const matrix src);
//void load_matrix(istream& is, matrix src);

//float determinant(const matrix src);
//void inverse(matrix dest, const matrix src, const matrix srct); // mobile->Rinv EQ mobile->Rt

#endif
